import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.util.List;

/*
反序列化
 */
public class ObjectInputStreamTest01 {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream("chapter21\\students"));
        Object o = ois.readObject();
        System.out.println(o.toString());
        ois.close();

        //**************************************************************************************************
        ObjectInputStream ois1 = new ObjectInputStream(new FileInputStream("chapter21\\students1"));
        List<Student> list =(List<Student>)ois1.readObject(); //强转成list
        for (Student s:list
             ) {
            System.out.println(s);
        }
        ois1.close();
    }
}
